﻿#ifndef NSSHARE_SYS_KEY_EVENT_H_
#define NSSHARE_SYS_KEY_EVENT_H_


namespace nsshare
{
namespace sys
{
class KeyEvent
{
public:
    enum KeyEventType
    {
        kKeyUp = 1,
        kKeyDown,
        kKeyPress,
    };

    enum KeyValue
    {                
        kLButton = 1,
        kRButton = 2,
        kCancel = 3,
        kMButton = 4,
        kXButton1 = 5,
        kXButton2 = 6,
        kBack = 8,
        kTab = 9,
        kLineFeed = 10,
        kClear = 12,
        kReturn = 13,
        kEnter = 13,
        kShiftKey = 16,
        kControlKey = 17,
        kMenu = 18,
        kPause = 19,
        kCapsLock = 20,
        kCapital = 20,
        kKanaMode = 21,
        kHangulMode = 21,
        kHanguelMode = 21,
        kJunjaMode = 23,
        kFinalMode = 24,
        kKanjiMode = 25,
        kHanjaMode = 25,
        kEscape = 27,
        kIMEConvert = 28,
        kIMENonconvert = 29,
        kIMEAceept = 30,
        kIMEAccept = 30,
        kIMEModeChange = 31,
        kSpace = 32,
        kPrior = 33,
        kPageUp = 33,
        kPageDown = 34,
        kNext = 34,
        kEnd = 35,
        kHome = 36,
        kLeft = 37,
        kUp = 38,
        kRight = 39,
        kDown = 40,
        kSelect = 41,
        kPrint = 42,
        kExecute = 43,
        kSnapshot = 44,
        kPrintScreen = 44,
        kInsert = 45,
        kDelete = 46,
        kHelp = 47,
        kD0 = 48,
        kD1 = 49,
        kD2 = 50,
        kD3 = 51,
        kD4 = 52,
        kD5 = 53,
        kD6 = 54,
        kD7 = 55,
        kD8 = 56,
        kD9 = 57,
        kA = 65,
        kB = 66,
        kC = 67,
        kD = 68,
        kE = 69,
        kF = 70,
        kG = 71,
        kH = 72,
        kI = 73,
        kJ = 74,
        kK = 75,
        kL = 76,
        kM = 77,
        kN = 78,
        kO = 79,
        kP = 80,
        kQ = 81,
        kR = 82,
        kS = 83,
        kT = 84,
        kU = 85,
        kV = 86,
        kW = 87,
        kX = 88,
        kY = 89,
        kZ = 90,
        kLWin = 91,
        kRWin = 92,
        kApps = 93,
        kSleep = 95,
        kNumPad0 = 96,
        kNumPad1 = 97,
        kNumPad2 = 98,
        kNumPad3 = 99,
        kNumPad4 = 100,
        kNumPad5 = 101,
        kNumPad6 = 102,
        kNumPad7 = 103,
        kNumPad8 = 104,
        kNumPad9 = 105,
        kMultiply = 106,
        kAdd = 107,
        kSeparator = 108,
        kSubtract = 109,
        kDecimal = 110,
        kDivide = 111,
        kF1 = 112,
        kF2 = 113,
        kF3 = 114,
        kF4 = 115,
        kF5 = 116,
        kF6 = 117,
        kF7 = 118,
        kF8 = 119,
        kF9 = 120,
        kF10 = 121,
        kF11 = 122,
        kF12 = 123,
        kF13 = 124,
        kF14 = 125,
        kF15 = 126,
        kF16 = 127,
        kF17 = 128,
        kF18 = 129,
        kF19 = 130,
        kF20 = 131,
        kF21 = 132,
        kF22 = 133,
        kF23 = 134,
        kF24 = 135,
        kNumLock = 144,
        kScroll = 145,
        kLShiftKey = 160,
        kRShiftKey = 161,
        kLControlKey = 162,
        kRControlKey = 163,
        kLMenu = 164,
        kRMenu = 165,
        kBrowserBack = 166,
        kBrowserForward = 167,
        kBrowserRefresh = 168,
        kBrowserStop = 169,
        kBrowserSearch = 170,
        kBrowserFavorites = 171,
        kBrowserHome = 172,
        kVolumeMute = 173,
        kVolumeDown = 174,
        kVolumeUp = 175,
        kMediaNextTrack = 176,
        kMediaPreviousTrack = 177,
        kMediaStop = 178,
        kMediaPlayPause = 179,
        kLaunchMail = 180,
        kSelectMedia = 181,
        kLaunchApplication1 = 182,
        kLaunchApplication2 = 183,
        kOemSemicolon = 186,
        kOem1 = 186,
        kOemplus = 187,
        kOemcomma = 188,
        kOemMinus = 189,
        kOemPeriod = 190,
        kOemQuestion = 191,
        kOem2 = 191,
        kOemtilde = 192,
        kOem3 = 192,
        kOemOpenBrackets = 219,
        kOem4 = 219,
        kOemPipe = 220,
        kOem5 = 220,
        kOemCloseBrackets = 221,
        kOem6 = 221,
        kOemQuotes = 222,
        kOem7 = 222,
        kOem8 = 223,
        kOemBackslash = 226,
        kOem102 = 226,
        kProcessKey = 229,
        kPacket = 231,
        kAttn = 246,
        kCrsel = 247,
        kExsel = 248,
        kEraseEof = 249,
        kPlay = 250,
        kZoom = 251,
        kNoName = 252,
        kPa1 = 253,
        kOemClear = 254,
        kKeyCode = 0xFFFF,
        kShift = 0x10000,
        kControl = 0x20000,
        kAlt = 0x40000,
        kModifiers = 0xFFFF0000
    };

public:
    KeyEvent()
    {
        type_ = static_cast<KeyEventType>(0);
        value_ = static_cast<KeyValue>(0);
    }

    ~KeyEvent()
    {
    }
            
    void set_type(const KeyEventType type) { type_ = type; }
    void set_value(const KeyValue value) { value_ = value; }

    KeyEventType type() const { return type_; }
    KeyValue value() const { return value_; }

private:
    KeyEventType type_;
    KeyValue value_;
};

}
}

#endif